package com.study.lxy.classload;

import java.util.Random;

public class AbsExtendTest {

    private MyAbstractClass myAbstractClass;

    public void test1(){
        buildClass();
        myAbstractClass.function1();
    }

    public void buildClass(){
        Random random = new Random();
        int i = random.nextInt(100);
        if(i >= 50){
            myAbstractClass = new MyExtendClass();
        } else {
            myAbstractClass = new MyExtendClass2();
        }
    }

    public static void main(String[] args) {
        AbsExtendTest test = new AbsExtendTest();
        test.test1();
    }
}
